#include "TestXml.h"

#include <Xml/XmlPath.h>

TestXml::TestXml()
{
}

TestXml::~TestXml()
{
}

void TestXml::initTestCase()
{
}

void TestXml::cleanupTestCase()
{
}

void TestXml::safeDataPathName_data()
{
    QTest::addColumn<QString>("name");
    QTest::addColumn<QString>("expected");
    QTest::newRow("plain value") << QString("Robin") << QString("Robin");
    QTest::newRow("two parts") << QString("Robin Hood") << QString("Robin_Hood");
    QTest::newRow("quotes") << QString("\'Robin Hood\'") << QString("_Robin_Hood_");
    QTest::newRow("underscores") << QString("Robin_Hood") << QString("Robin_Hood");
    QTest::newRow("multiple spaces") << QString("Robin the   Hood") << QString("Robin_the_Hood");
    QTest::newRow("apostrophe") << QString("Robin l\'Hood") << QString("Robin_l_Hood");
}

void TestXml::safeDataPathName()
{
    QFETCH(QString, name);
    QFETCH(QString, expected);
    QString got = XmlPath::safeDataPathName(name);
    QCOMPARE(got, expected);
}
